﻿import $ = require("jquery");
import ko = require("knockout");

class Release {
    public static create() {
        ko.bindingHandlers.Release = {
            init: (element, valueAccessor: () => KnockoutObservable<number>|any) => {
                var callback = valueAccessor();
                $(element).on("manip_release.hold manip_release.drag", (event, args) => {
                    callback(args);
                });
            },
            update: () => { }
        }

        ko.bindingHandlers.ReleaseDrag = {
            init: (element, valueAccessor: () => KnockoutObservable<number>|any) => {
                var callback = valueAccessor();
                $(element).on("manip_release.drag", (event, args) => {
                    callback(args);
                });
            },
            update: () => { }
        }
    }
}

export = Release;